<!-- BEGIN NEWS FORM -->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'news-form',
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions'=>array(
		'class'=>'horizontal-form',
		'enctype'=>'multipart/form-data'
	),
)); ?>
<div class="form-body">
    <div class="row">
        <div class="col-md-3">
            <div class="fileupload fileupload-new <?php echo ($model->getError('title') ? 'has-error' : ''); ?>" data-provides="fileupload">
				<div class="fileupload-new thumbnail" style="width: 240px; height: 150px;">
                <?php if ($model->isNewRecord) : ?>
					<img src="<?php echo Yii::app()->theme->baseUrl; ?>/img/no_image.gif" alt="" />
                <?php else : ?>
                	<img src="<?php echo $this->getImageUrl() . 'news/' . date('Ymd', strtotime($model->posteddate)) . '/' . $model->image; ?>" alt="" />
                <?php endif; ?>
				</div>
				<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 240px; max-height: 150px; line-height: 20px;"></div>
				<div>
					<span class="btn default btn-file">
						<span class="fileupload-new"><i class="icon-paper-clip"></i> Select image</span>
						<span class="fileupload-exists"><i class="icon-undo"></i> Change</span>
						<?php echo $form->fileField($model, 'image', array('class'=>'default')); ?>
					</span>
					<a href="#" class="btn red fileupload-exists" data-dismiss="fileupload"><i class="icon-trash"></i> Remove</a>
				</div>
                <?php echo $form->error($model, 'image', array('class'=>'help-block')); ?>
			</div>
        </div>
        <div class="col-md-9">
            <div class="form-group <?php echo ($model->getError('title') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'title', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'title', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'title', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('description') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'description', array('class'=>'control-label')); ?>
                <?php echo $form->textArea($model, 'description', array('class'=>'form-control', 'rows'=>5)); ?>
                <?php echo $form->error($model, 'description', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('featured') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'featured', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'featured', array('Y'=>'Ưu tiên', 'N'=>'Không ưu tiên'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'status', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('status') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'status', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'status', array('A'=>'Hoạt động', 'I'=>'Ngừng hoạt động', 'P'=>'Chờ duyệt'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'status', array('class'=>'help-block')); ?>
            </div>
        </div>
    </div>
    <div class="row">
    	<div class="col-md-12">
        	<div class="form-group <?php echo ($model->getError('content') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'content', array('class'=>'control-label')); ?>
                <?php $this->widget('application.extensions.ckeditor.CKEditor', array(
					'model'=>$model,
					'attribute'=>'content',
					'language'=>'vi',
					'editorTemplate'=>'full',
					'height'=>'800px',
					'htmlOptions'=>array('rows'=>20,'class'=>'form-control'),
				)); ?>
				<?php echo $form->error($model, 'content', array('class'=>'help-block')); ?>
			</div>
        </div>
    </div>
</div>
<div class="form-actions right">
	<button type="reset" class="btn default">Cancel</button>
	<button type="submit" class="btn blue" onClick="Custom.showLoading();"><i class="icon-ok"></i> <?php echo $model->isNewRecord ? 'Đăng tin' : 'Cập nhật tin'; ?></button>
</div>
<?php $this->endWidget(); ?>
<!-- END NEWS FORM -->